﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace Philosophy
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
            _groups = new ObservableCollection<Groups_Items>();
            //------------------------------------------------;
            var group_1 = new Groups_Items { Group_Name = "Группа 1" };
            _groups.Add(group_1);
            group_1.Items.Add(new Collection_Items 
            { 
                Name_Item = "1",
                Color = "Yellow", 
                ImageAdress = "/Assets/Image.jpg"
            });
            group_1.Items.Add(new Collection_Items
            {
                Name_Item = "2",
                Color = "Yellow",
                ImageAdress = "/Assets/Image.jpg"
            });
            group_1.Items.Add(new Collection_Items
            { 
                Name_Item = "3",
                Color = "Yellow", 
                ImageAdress = "/Assets/Image.jpg"
            });
            //------------------------------------------------;
            var group_2 = new Groups_Items { Group_Name = "Группа 2" };
            _groups.Add(group_2);
            group_2.Items.Add(new Collection_Items
            {
                Name_Item = "1", 
                Color = "Yellow", 
                ImageAdress = "/Assets/Image.jpg"
            });
            group_2.Items.Add(new Collection_Items
            { 
                Name_Item = "2",
                Color = "Yellow",
                ImageAdress = "/Assets/Image.jpg"
            });
            //------------------------------------------------;
            var group_3 = new Groups_Items { Group_Name = "Группа 3" };
            _groups.Add(group_3);
            group_3.Items.Add(new Collection_Items 
            {
                Name_Item = "1",
                Color = "Yellow",
                ImageAdress = "/Assets/Image.jpg" 
            });
            group_3.Items.Add(new Collection_Items 
            { 
                Name_Item = "2",
                Color = "Yellow",
                ImageAdress = "/Assets/Image.jpg"
            });
            //------------------------------------------------;

            var group_record = new Groups_Items { Group_Name = "Рекорды" };
            _groups.Add(group_record);
            group_record.Items.Add(new Collection_Items
            {
                Color = "Red", 
                Name_Item = "Рекорды",
                ImageAdress = "/Assets/Кубок.jpg"
            });

            //------------------------------------------------;

            cvsMain.Source = _groups;
        }

        private ObservableCollection <Groups_Items> _groups;

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // TODO
        }

        private void gvMain_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (gvMain.SelectedIndex != 7)
            { this.Frame.Navigate(typeof(Page_of_Type)); }
            else
            { this.Frame.Navigate(typeof(PageRecord)); }
        }
    }
}
